package com.tuijian.service.track;

import com.alibaba.fastjson.JSON;
import com.tuijian.vo.TrackingData;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class TrackService {
    /**
     * kafkaTemplate对象
     */
    @Resource
    private KafkaTemplate<String, Object> kafkaTemplate;

    public void send2kafka(TrackingData trackingData){
        kafkaTemplate.send("track", JSON.toJSONString(trackingData));
    }
}
